#ifndef __DATABASELIB_H__
#define __DATABASELIB_H__
#include <QSqlDatabase>
#include <QSqlError>

class QStringView;
class QString;





extern const QString g_QPSQL;
extern const QString g_QMYSQL;
extern const QString g_QOCI;
extern const QString g_QODBC;
extern const QString g_QDB2;
extern const QString g_QTDS;
extern const QString g_QSQLITE;
extern const QString g_QIBASE;

class  DatabaseLib final
{
public:
	explicit DatabaseLib();
	~DatabaseLib() = default;
	bool ConnectDB(QStringView _connectName, QStringView filePath, QStringView dbType);
	void DisconnectDB(QStringView _connectName)noexcept;
	[[nodiscard]] bool IsConnect()noexcept { return m_IsConnect; }
	QSqlDatabase &GetDBInstance();
	QSqlError GetDBError()noexcept { return m_db.lastError(); }
private:
	DatabaseLib(const DatabaseLib&) = delete;
	DatabaseLib operator= (const DatabaseLib&) = delete;
	DatabaseLib(const DatabaseLib&&) = delete;
	DatabaseLib operator= (const DatabaseLib&&) = delete;
private:
	QSqlDatabase m_db;
	bool m_IsConnect;
};

#endif//__DATABASELIB_H__



